package com.insmess.speech.config;

import com.insmess.speech.sdk.template.InsmessAsrTemplate;
import com.insmess.speech.sdk.template.InsmessTextTemplate;
import com.insmess.speech.sdk.template.InsmessTtsTemplate;
import com.insmess.speech.sdk.template.InsmessVectorTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SpeechConfig {
    @Value("${speech-server.url}")
    private String speechServerUrl;

    private static final String ASR_URI = "/paddlespeech/asr";
    private static final String TTS_URI = "/paddlespeech/tts";
    /**
     * 声纹
     */
    private static final String VECTOR_URI = "/paddlespeech/vector";
    /**
     * 标点恢复
     */
    private static final String TEXT = "/paddlespeech/text";

    @Bean
    public InsmessAsrTemplate insmessAsrTemplate() {
        return new InsmessAsrTemplate(speechServerUrl + ASR_URI);
    }

    @Bean
    public InsmessTtsTemplate insmessTtsTemplate() {
        return new InsmessTtsTemplate(speechServerUrl + TTS_URI);
    }

    @Bean
    public InsmessVectorTemplate insmessVectorTemplate() {
        return new InsmessVectorTemplate(speechServerUrl + VECTOR_URI);
    }

    @Bean
    public InsmessTextTemplate insmessTextTemplate() {
        return new InsmessTextTemplate(speechServerUrl + TEXT);
    }
}
